package com.example.design.shejimoshi.structure.decorator;

import com.example.design.shejimoshi.structure.decorator.core.*;

/**
 * @Description TODO
 * @date 2022/10/21 16:08
 * @Author liuzhihui
 * @Version 1.0
 */
public class DecoratorPatternDemo {
    public static void main(String[] args) {
        Shape circle = new Circle();
        System.out.println("Circle with normal border");
        circle.draw();

        // 给Circle增强
        ShapeDecorator redCircle = new RedShapeDecorator(new Circle());
        System.out.println("\nCircle of red border");
        redCircle.draw();

        // 给Rectangle增强
        ShapeDecorator redRectangle = new RedShapeDecorator(new Rectangle());
        System.out.println("\nRectangle of red border");
        redRectangle.draw();
    }
}
